package cn.dida.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.dida.dao.CompanyDao;
import cn.dida.model.Company;
import cn.dida.model.Pageable;
import cn.dida.service.CompanyService;
/**
 * 公司管理 业务层接口实现类
 * @author weiwei
 * */
@Service
public class CompanyServiceImpl implements CompanyService {
    @Autowired
    private CompanyDao companyDao;

    
    @Override
    public Pageable<Company> queryCompany(String keyword, Integer state, int page) {
        return companyDao.query(keyword, state, page);
    }

    @Override
    public List<Company> queryCompany(Integer state) {
        return companyDao.query(state);
    }
    @Transactional
    @Override
    public Boolean insertCompany(Company company) {
        return companyDao.insert(company) == 1;
    }
    @Transactional
    @Override
    public Boolean updateCompany(Company company) {
        return companyDao.update(company) == 1;
    }

    @Override
    public Company getCompany(Integer id) {
        return companyDao.get(id);
    }

    @Deprecated
    @Override
    public Company getCompany(String account, String pwd) {
        return companyDao.get(account, pwd);
    }
    @Transactional
    @Override
    public Boolean deleteCompany(Integer id) {
        return companyDao.delete(id) == 1;
    }
}
